<template lang="">
    <div>
        <van-field  label='标题' v-model='form.title'/>
        <van-field  label='内容' v-model='form.content'/>
        <van-uploader :after-read='upload'/>
        <van-button  @click='add'>添加</van-button>
    </div>
</template>
<script>
export default {
    data(){
        return{
            form:{'author_id':0,'pic':''}
        }
    },
    methods: {
        upload(file){
            //图片上传
            this.form.pic = '/static/upload/1.jpg'
        },
        add(){
            let userid = localStorage.getItem('userid')
            if(userid){
                this.form.author_id = userid
            }
            this.axios.post('course/booksM',this.form).then(res=>{
                
            })
        }
    },
}
</script>
<style lang="">
    
</style>